package com.hmi.simulatedrive.fragment

import com.amap.api.navi.AMapNavi
import com.amap.api.navi.AMapNaviListener
import com.amap.api.navi.AMapNaviViewListener
import com.amap.api.navi.model.AMapCalcRouteResult
import com.amap.api.navi.model.AMapLaneInfo
import com.amap.api.navi.model.AMapModelCross
import com.amap.api.navi.model.AMapNaviCameraInfo
import com.amap.api.navi.model.AMapNaviCross
import com.amap.api.navi.model.AMapNaviLocation
import com.amap.api.navi.model.AMapNaviRouteNotifyData
import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo
import com.amap.api.navi.model.AMapServiceAreaInfo
import com.amap.api.navi.model.AimLessModeCongestionInfo
import com.amap.api.navi.model.AimLessModeStat
import com.amap.api.navi.model.NaviInfo
import com.amap.api.navi.model.NaviLatLng
import com.blankj.utilcode.util.ToastUtils
import com.hmi.simulatedrive.utils.TTSController

open class BaseNaviMapFragment: BaseFragment(), AMapNaviListener, AMapNaviViewListener {
    protected val mAMapNavi by lazy {
        AMapNavi.getInstance(requireActivity())
    }
    protected var mTtsManager: TTSController? = null
    protected var mEndLatlng = NaviLatLng(40.084894, 116.603039)
    protected var mStartLatlng = NaviLatLng(39.825934, 116.342972)
    var p1 = NaviLatLng(39.831135, 116.36056) //北京国际文化城

    protected val sList: MutableList<NaviLatLng> = mutableListOf<NaviLatLng>()
    protected val eList: MutableList<NaviLatLng> = mutableListOf<NaviLatLng>()
    protected var mWayPointList: List<NaviLatLng> = ArrayList()

    override fun onInitNaviFailure() {
        ToastUtils.showLong("导航引擎初始化失败，请尝试重启程序！")
    }

    override fun onInitNaviSuccess() {
        // 初始化导航功能
    }

    override fun onStartNavi(p0: Int) {
        
    }

    override fun onTrafficStatusUpdate() {
        
    }

    override fun onLocationChange(p0: AMapNaviLocation?) {
        
    }

    override fun onGetNavigationText(p0: Int, p1: String?) {
        
    }

    override fun onGetNavigationText(p0: String?) {
        
    }

    override fun onEndEmulatorNavi() {
        
    }

    override fun onArriveDestination() {
        
    }

    override fun onCalculateRouteFailure(p0: Int) {

    }

    override fun onCalculateRouteFailure(result: AMapCalcRouteResult?) {
        ToastUtils.showLong("errorInfo：" + result?.getErrorDetail() + ", Message：" + result?.getErrorDescription())
    }

    override fun onReCalculateRouteForYaw() {
        
    }

    override fun onReCalculateRouteForTrafficJam() {
        
    }

    override fun onArrivedWayPoint(p0: Int) {
        
    }

    override fun onGpsOpenStatus(p0: Boolean) {
        
    }

    override fun onNaviInfoUpdate(p0: NaviInfo?) {
        
    }

    override fun updateCameraInfo(p0: Array<out AMapNaviCameraInfo>?) {
        
    }

    override fun updateIntervalCameraInfo(
        p0: AMapNaviCameraInfo?,
        p1: AMapNaviCameraInfo?,
        p2: Int
    ) {
        
    }

    override fun onServiceAreaUpdate(p0: Array<out AMapServiceAreaInfo>?) {
        
    }

    override fun showCross(p0: AMapNaviCross?) {
        
    }

    override fun hideCross() {
        
    }

    override fun showModeCross(p0: AMapModelCross?) {
        
    }

    override fun hideModeCross() {
        
    }

    override fun showLaneInfo(p0: Array<out AMapLaneInfo>?, p1: ByteArray?, p2: ByteArray?) {
        
    }

    override fun showLaneInfo(p0: AMapLaneInfo?) {
        
    }

    override fun hideLaneInfo() {
        
    }

    override fun onCalculateRouteSuccess(p0: IntArray?) {
        
    }

    override fun onCalculateRouteSuccess(p0: AMapCalcRouteResult?) {
    }

    override fun notifyParallelRoad(p0: Int) {
        
    }

    override fun OnUpdateTrafficFacility(p0: Array<out AMapNaviTrafficFacilityInfo>?) {
        
    }

    override fun OnUpdateTrafficFacility(p0: AMapNaviTrafficFacilityInfo?) {
        
    }

    override fun updateAimlessModeStatistics(p0: AimLessModeStat?) {
        
    }

    override fun updateAimlessModeCongestionInfo(p0: AimLessModeCongestionInfo?) {
        
    }

    override fun onPlayRing(p0: Int) {
        
    }

    override fun onNaviRouteNotify(p0: AMapNaviRouteNotifyData?) {
        
    }

    override fun onGpsSignalWeak(p0: Boolean) {
        
    }

    // ===============================================================================
    // AMapNaviViewListener
    // ===============================================================================
    override fun onNaviSetting() {

    }

    override fun onNaviCancel() {

    }

    override fun onNaviBackClick(): Boolean {
        return false
    }

    override fun onNaviMapMode(p0: Int) {

    }

    override fun onNaviTurnClick() {

    }

    override fun onNextRoadClick() {

    }

    override fun onScanViewButtonClick() {

    }

    override fun onLockMap(p0: Boolean) {

    }

    override fun onNaviViewLoaded() {

    }

    override fun onMapTypeChanged(p0: Int) {

    }

    override fun onNaviViewShowMode(p0: Int) {

    }
}